Initial addition of generated spanner database to terraform. (#159)

Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
The Magician 2019-01-16 13:41:27 -08:00 committed by Alex Stephen
parent 2bd4f747f9
commit 4b1523e833
2 changed files with 11 additions and 11 deletions

View file

@ -50,9 +50,8 @@ options:
name: name:
description: description:
- A unique identifier for the database, which cannot be changed after the instance - A unique identifier for the database, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]. is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length. required: true
required: false
extra_statements: extra_statements:
description: description:
- 'An optional list of DDL statements to run inside the newly created database. - 'An optional list of DDL statements to run inside the newly created database.
@ -103,8 +102,7 @@ RETURN = '''
name: name:
description: description:
- A unique identifier for the database, which cannot be changed after the instance - A unique identifier for the database, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]. is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
returned: success returned: success
type: str type: str
extraStatements: extraStatements:
@ -182,8 +180,7 @@ def create(module, link):
def update(module, link): def update(module, link):
delete(module, self_link(module)) module.fail_json(msg="Database cannot be edited")
create(module, collection(module))
def delete(module, link): def delete(module, link):
@ -192,7 +189,11 @@ def delete(module, link):
def resource_to_request(module): def resource_to_request(module):
request = {u'name': module.params.get('name'), u'extraStatements': module.params.get('extra_statements')} request = {
u'instance': replace_resource_dict(module.params.get(u'instance', {}), 'name'),
u'name': module.params.get('name'),
u'extraStatements': module.params.get('extra_statements'),
}
request = encode_request(request, module) request = encode_request(request, module)
return_vals = {} return_vals = {}
for k, v in request.items(): for k, v in request.items():
@ -262,7 +263,7 @@ def is_different(module, response):
# Remove unnecessary properties from the response. # Remove unnecessary properties from the response.
# This is for doing comparisons with Ansible's current parameters. # This is for doing comparisons with Ansible's current parameters.
def response_to_hash(module, response): def response_to_hash(module, response):
return {u'name': response.get(u'name'), u'extraStatements': module.params.get('extra_statements')} return {u'name': module.params.get('name'), u'extraStatements': module.params.get('extra_statements')}
def decode_response(response, module): def decode_response(response, module):

View file

@ -69,8 +69,7 @@ items:
name: name:
description: description:
- A unique identifier for the database, which cannot be changed after the instance - A unique identifier for the database, which cannot be changed after the instance
is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]. is created. Values are of the form [a-z][-a-z0-9]*[a-z0-9].
The final segment of the name must be between 6 and 30 characters in length.
returned: success returned: success
type: str type: str
extraStatements: extraStatements: