Skip to content

Update for Terraform changes, fix logging package #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ local apt = import "../cmd/apt.jsonnet";
] else [],
local logging =
if instance.enableLogging then [
"curl -s https://dl.google.com/cloudagents/install-logging-agent.sh | bash",
"curl -s https://storage.googleapis.com/signals-agents/logging/google-fluentd-install.sh | bash",
] else [],
cmds+: monitoring + jmx + logging,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ local apt = import "../cmd/apt.jsonnet";
] else [],
local logging =
if instance.enableLogging then [
"curl -s https://dl.google.com/cloudagents/install-logging-agent.sh | bash",
"curl -s https://storage.googleapis.com/signals-agents/logging/google-fluentd-install.sh | bash",
] else [],
cmds+: monitoring + jmx + logging,
},
Expand Down Expand Up @@ -167,7 +167,7 @@ local apt = import "../cmd/apt.jsonnet";
} + {
[name]: DnsRecord {
name: "${google_compute_instance." + name + ".name}." + service.dnsZone.dnsName,
rrdatas: ["${google_compute_instance." + name + ".network_interface.0.access_config.0.nat_ip}"],
rrdatas: ["${google_compute_instance." + name + ".network_interface.0.access_config.0.assigned_nat_ip}"],
} for name in std.objectFields(instances)
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ local apt = import "../cmd/apt.libsonnet";
} + {
[name]: DnsRecord {
name: "${google_compute_instance." + name + ".name}." + service.dnsZone.dnsName,
rrdatas: ["${google_compute_instance." + name + ".network_interface.0.access_config.0.nat_ip}"],
rrdatas: ["${google_compute_instance." + name + ".network_interface.0.access_config.0.assigned_nat_ip}"],
} for name in std.objectFields(instances)
},
},
Expand Down Expand Up @@ -269,7 +269,7 @@ local apt = import "../cmd/apt.libsonnet";
google_compute_target_pool: {
"${-}": {
name: "${-}",
depends_on: "google_compute_http_health_check.${-}",
depends_on: ["google_compute_http_health_check.${-}"],
health_checks: ["${-}"],
instances: ["%s/%s" % [instances[iname].zone, iname]
for iname in attached_instances],
Expand Down
15 changes: 14 additions & 1 deletion case_studies/micromanage/micromanage.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def aux(ctx, service_name, service):

return r


def get_build_artefacts(config):
"""Create all required build artefacts, modify config to refer to them."""

Expand Down Expand Up @@ -216,10 +217,22 @@ def aux(ctx, service_name, service):
if not len(tfs):
tfs['empty.tf'] = {}

for tfname, tf in tfs.iteritems():
if 'resource' in tf:
new_resources = {}
for rtype_name, rtype_dict in tf['resource'].iteritems():
if rtype_dict:
new_resources[rtype_name] = rtype_dict
for r_name, r_dict in rtype_dict.iteritems():
# depends_on changed to always be a list.
if 'depends_on' in r_dict and isinstance(r_dict['depends_on'], basestring):
r_dict['depends_on'] = [r_dict['depends_on']]
# Remove empty resource dicts, workaround for
# https://github.com/hashicorp/terraform/issues/6368
tf['resource'] = new_resources
return tfs



def confirmation_dialog(msg):
sys.stdout.write('%s [y/N]: ' % msg)
while True:
Expand Down
2 changes: 1 addition & 1 deletion case_studies/micromanage/service_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def compileProvider(self, environment_name, environment):
'provider': {
'google': {
'alias': environment_name,
'account_file': json.dumps(environment['serviceAccount']),
'credentials': json.dumps(environment['serviceAccount']),
'project': environment['project'],
'region' : environment['region'],
},
Expand Down